package com.rich.house.mq;

import com.rich.common.constant.HouseAuditConstant;
import com.rich.house.mapper.HouseMapper;
import com.rich.house.mapper.WantMapper;
import com.rich.house.vo.AuditVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: guofeng
 * @Date: 2021/08/24/19:54
 * @Description:
 */
@Configuration
@Slf4j
public class RabbitMqConsumer {

    @Autowired
    private HouseMapper houseMapper;

    @Autowired
    private WantMapper wantMapper;


    @RabbitListener(queues = {"houseAudit.dead.queue"})
    @RabbitHandler
    public void HouseAuditUpdate(AuditVo auditVo){
        log.info("进入死信队列");
        if(HouseAuditConstant.BUY_HOUSE.equals(auditVo.getType()) || HouseAuditConstant.RENT_HOUSE.equals(auditVo.getType())){
            /*houseMapper.update(auditVo);*/
        }else{
            /*wantMapper.update(auditVo);*/
        }
    }
}
